package com.example.myapplication;

import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;

public class ContactDetailActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_contact_detail);

        TextView nameTextView = findViewById(R.id.person_name);
        TextView phoneTextView = findViewById(R.id.phone_number);
        TextView addressTextView = findViewById(R.id.address);
        TextView ageTextView = findViewById(R.id.age); // 新增年龄 TextView
        TextView interestTextView = findViewById(R.id.interest); // 新增兴趣爱好 TextView
        TextView jobTextView = findViewById(R.id.job); // 新增工作 TextView
        ImageView avatarImageView = findViewById(R.id.person_avatar);

        String personName = getIntent().getStringExtra("person_name");
        int imageId = getIntent().getIntExtra("image_id", R.drawable.dxx);
        String phoneNumber = getIntent().getStringExtra("phone_number");
        String address = getIntent().getStringExtra("address");
        String age = getIntent().getStringExtra("age"); // 获取年龄
        String interest = getIntent().getStringExtra("interest"); // 获取兴趣爱好
        String job = getIntent().getStringExtra("job"); // 获取工作

        nameTextView.setText(personName);
        phoneTextView.setText(phoneNumber);
        addressTextView.setText(address);
        ageTextView.setText(age); // 设置年龄
        interestTextView.setText(interest); // 设置兴趣爱好
        jobTextView.setText(job); // 设置工作
        avatarImageView.setImageResource(imageId);
    }
}